import { mock,Random } from 'mockjs';

// 登录
mock('http://localhost:3000/login', 'post', function (options){
  const {body} = options;
  const data = JSON.parse(body);
  return {
    code: 200,
    message: 'success',
    data: {
      id: Random.id(),
      token: Random.guid(),
      name: data.username,
      password: data.password
    }
  }
});

// 注册
mock('http://localhost:3000/register', 'post', function (options){
  const {body} = options;
  const data = JSON.parse(body);
  return {
    code: 200,
    message: 'success',
    data: {
      id: Random.guid(),
      name: data.username,
      password: data.password
    }
  }
});
